<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "order".
 *
 * @property int $id
 * @property int $order_id
 * @property int $goods_id
 * @property string $rand
 * @property int $randtine
 * @property int $status
 */
class Order extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'order';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['order_id', 'goods_id', 'randtine', 'status'], 'integer'],
            [['rand'], 'string', 'max' => 50],
            [['rand'], 'unique'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'order_id' => 'Order ID',
            'goods_id' => 'Goods ID',
            'rand' => 'Rand',
            'randtine' => 'Randtine',
            'status' => 'Status',
        ];
    }

    //入订单库
    public function getOne($rand,$goods_id,$randtine)
    {
        $this->goods_id=$id;
        $this->rand=$rand;
        $this->randtine=$randtine;
        return $this->save();
    }
}
